<script>

  export default {
    data() {
      return {}
    },
    methods: {
//      https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx292c8ee7e4a1b4af&redirect_uri=http%3A%2F%2Fwww.dyd61.com%2FnewGame%2Findex.html&response_type=code&scope=snsapi_userinfo&state=123&connect_redirect=1#wechat_redirect
//      https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx292c8ee7e4a1b4af&redirect_uri=http%3a%2f%2f17478r34g4.iask.in&response_type=code&scope=snsapi_userinfo&state=123&connect_redirect=1#wechat_redirect
      WeChatLogin() {
        if (config.jc.info.baseToken) {
          this.$router.push('/plain');
          return;
        }
        var _config = {"openid": config.jc.info.openid(), "accessToken": Storage.get('access_token')};
        console.log('AAA' + JSON.stringify(_config));
        $.ajax({
          url: config.appCode + config.szg.fastLogin,
          type: "GET",
          data: _config,
        }).done((data) => {
          if (data.status == 10101) {
            config.jc.info.Token = data.result.token;
            config.jc.info.baseToken = BASE64.encode("token:" + data.result.token);
            config.jc.info.nickName = data.result.nickname;
            config.jc.info.nickImg = data.result.imgurl;
            config.jc.info.jf = data.result.jf;
            config.jc.info.flag = data.result.flag;
            Storage.set("Token", config.jc.info.Token);
            Storage.set("baseToken", config.jc.info.baseToken);
            Storage.set("nickName", config.jc.info.nickName);
            Storage.set("nickImg", config.jc.info.nickImg);
            Storage.set("jf", config.jc.info.jf);
            Storage.set("flag", config.jc.info.flag);
            DYD.msg(data.desc);
            this.$router.replace("/plain");
          } else {
            window.location.href = config.szg.start;
            layer.alert(JSON.stringify(data));
          }
        });
      }
    }
  }
</script>
<template>
  <div class="szg_login">
    <img src="../../../static/staticS/images/dyd_logo.png" class="L1_img">
    <div class="L1_Title">欢迎您来玩！</div>
    <a class="L1_button" @click="WeChatLogin()">点击微信授权</a>
  </div>
</template>
<style>

</style>
